#!/bin/sh
# Colorize
# Andrey Zakharov 20-03-2010
#

usage()
{
    echo "$0 value color1threshold color2threshold color3threshold"
    exit 1
}

[ $# -lt 4 ] && usage

[ $1 -lt $4 ] && (
    [ $1 -lt $3 ] && (
        [ $1 -lt $2 ] && ( echo $1
        ) || ( echo "\${color1}$1" )
    ) || ( echo "\${color2}$1" )
) || ( echo "\${color3}$1" )
